home *** CD-ROM | disk | FTP | other *** search
/ Virtual Sex Shoot / Virtual Sex Shoot.iso / mac / Virtual Sex Shoot / Virtual Sex Shoot.DXR / 00130.ls < prev    next >
Encoding:
Text File  |  1995-09-24  |  3.1 KB  |  104 lines

  1. global gDataStart, gDataStop, gDataFile, FileIO, gStoredTime, gAutomated, gWhichAutomatedClip, gLoadedTimeCodes
  2.  
  3. on initTracking
  4.   set gDataStart to the long time
  5.   if char 2 of gDataStart = ":" then
  6.     set gDataStart to "0" & gDataStart
  7.   end if
  8.   set gDataStart to (value(char 1 to 2 of gDataStart) * 60 * 60) + (value(char 4 to 5 of gDataStart) * 60) + value(char 7 to 8 of gDataStart)
  9. end
  10.  
  11. on exitTracking
  12.   writeData(RETURN & the long time & " Exited.")
  13.   set gDataStop to the long time
  14.   if char 2 of gDataStop = ":" then
  15.     set gDataStop to "0" & gDataStop
  16.   end if
  17.   set gDataStop to (value(char 1 to 2 of gDataStop) * 60 * 60) + (value(char 4 to 5 of gDataStop) * 60) + value(char 7 to 8 of gDataStop)
  18.   set elapsedTime to gDataStop - gDataStart
  19.   set hours to "00" & string(elapsedTime / 60 / 60)
  20.   set minutes to "00" & string(elapsedTime / 60 mod 60)
  21.   set seconds to "00" & string(elapsedTime mod 60)
  22.   set hours to chars(hours, the number of chars in hours - 1, the number of chars in hours)
  23.   set minutes to chars(minutes, the number of chars in minutes - 1, the number of chars in minutes)
  24.   set seconds to chars(seconds, the number of chars in seconds - 1, the number of chars in seconds)
  25.   writeData(hours & ":" & minutes & ":" & seconds & "  Total elapsed time." & RETURN & RETURN & RETURN)
  26.   writeDataFile()
  27. end
  28.  
  29. on readDataFile
  30.   if the machineType = 256 then
  31.     openXLib("FileIO.DLL")
  32.     set gDataFile to FileIO(mnew, "?read", "TXT")
  33.   else
  34.     set gDataFile to FileIO(mnew, "?read", "TEXT")
  35.   end if
  36.   if objectp(gDataFile) = 0 then
  37.     errorMessage()
  38.     go(the frame)
  39.   else
  40.     set adjustedTimeCodes to gDataFile(mReadFile)
  41.     do("set adjustedTimeCodes=" & line 3 of adjustedTimeCodes)
  42.     if developersKey() then
  43.       put adjustedTimeCodes
  44.     end if
  45.     if checkTimeCodes(adjustedTimeCodes) = 0 then
  46.       readDataFile()
  47.       exit
  48.     else
  49.       set gAutomated to 1
  50.       set gLoadedTimeCodes to adjustedTimeCodes
  51.       set gRecording to 0
  52.       set the timeoutScript to "nothing"
  53.       set gWhichAutomatedClip to 1
  54.       correlateSliderPositionsToMovieTime()
  55.       set gStoredTime to []
  56.       set gAutomatedTimes to []
  57.       set gWhichAutomatedClip to 1
  58.       advanceAutomatedMovie()
  59.     end if
  60.   end if
  61. end
  62.  
  63. on writeData theData
  64.   set gDataFile to gDataFile & theData & RETURN
  65. end
  66.  
  67. on writeDataFile whichData
  68.   if the machineType = 256 then
  69.     openXLib("FileIO.DLL")
  70.   end if
  71.   set gDataFile to FileIO(mnew, "?write", EMPTY)
  72.   if objectp(gDataFile) = 0 then
  73.     errorMessage()
  74.   else
  75.     gDataFile(mWriteString, "Digital Playground FantaSave (TM) data for Virtual Sex Shoot." & RETURN & RETURN)
  76.     if voidp(whichData) then
  77.       set whichData to gStoredTime
  78.     end if
  79.     gDataFile(mWriteString, string(whichData & RETURN))
  80.     if objectp(gDataFile) <> 0 then
  81.       gDataFile(mdispose)
  82.     end if
  83.   end if
  84. end
  85.  
  86. on errorMessage
  87.   if gDataFile = -43 then
  88.     nothing()
  89.   else
  90.     if (gDataFile = -33) or (gDataFile = -34) then
  91.       alert("This volume is full.")
  92.     else
  93.       alert("File I/O object was not made." & RETURN & "Error: " & string(gDataFile))
  94.       if not (the shiftDown) then
  95.         beep(2)
  96.       end if
  97.     end if
  98.   end if
  99. end
  100.  
  101. on stringEntry
  102.   writeData(EMPTY)
  103. end
  104.